﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Gedea.WinForm.Helpers;
using Gedea.Service;

namespace Gedea.WinForm
{
    public partial class Home : Form
    {
        #region Ctr
        public Home(bool isPpalForm)
        {
            if(isPpalForm)
                showSplashScreen();

            InitializeComponent();

            this.WindowState = FormWindowState.Maximized;
        }
        #endregion

        private void Home_Load(object sender, EventArgs e)
        {
            toolStripStatusLabel1.Text = "Usuario: ";
            toolStripStatusLabel2.Text = Credentials.currentUser.Name;

            gedeaSolutions.BalloonTipIcon = ToolTipIcon.Info;
            gedeaSolutions.BalloonTipText = "Bienvenido al Gestor de Débitos Automáticos";
            gedeaSolutions.BalloonTipTitle = "Gedea";
            gedeaSolutions.ShowBalloonTip(1000);

            //this.TopMost = true;
            //this.BringToFront();
            this.Activate();
        }

        private void nuevoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Gedea.WinForm.Forms.Customers.New a = Gedea.WinForm.Forms.Customers.New.Instance;
            a.MdiParent = this;
            a.AutoSize = true;
            a.WindowState = FormWindowState.Maximized;
            a.Show();
        }

        private void customizeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Gedea.WinForm.Forms.Company.AddEdit a = Gedea.WinForm.Forms.Company.AddEdit.Instance;
            a.MdiParent = this;
            a.AutoSize = true;
            a.WindowState = FormWindowState.Maximized;
            a.Show();
        }

        private void nuevoToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            Gedea.WinForm.Forms.Areas.New a = Gedea.WinForm.Forms.Areas.New.Instance;
            a.MdiParent = this;
            a.AutoSize = true;
            a.WindowState = FormWindowState.Maximized;
            a.Show();
        }

        private void emitirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Gedea.WinForm.Forms.FileText.Generate a = Gedea.WinForm.Forms.FileText.Generate.Instance;
            a.MdiParent = this;
            a.AutoSize = true;
            a.WindowState = FormWindowState.Maximized;
            a.Show();
        }

        private void respuestaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Gedea.WinForm.Forms.FileText.Upload a = Gedea.WinForm.Forms.FileText.Upload.Instance;
            a.MdiParent = this;
            a.AutoSize = true;
            a.WindowState = FormWindowState.Maximized;
            a.Show();
        }

        private void buscarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Gedea.WinForm.Forms.Customers.Search a = Gedea.WinForm.Forms.Customers.Search.Instance;
            a.MdiParent = this;
            a.AutoSize = true;
            a.WindowState = FormWindowState.Maximized;
            a.Show();
        }

        private void optionsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Gedea.WinForm.Forms.Settings a = Gedea.WinForm.Forms.Settings.Instance;
            a.MdiParent = this;
            a.AutoSize = true;
            a.WindowState = FormWindowState.Maximized;
            a.Show();
        }

        private void Home_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void showSplashScreen()
        {
            using (Waiting fsplash = new Waiting())
            {
                if (fsplash.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) this.Close();
            }
        }

        private void buscarEditarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Gedea.WinForm.Forms.Areas.Search a = Gedea.WinForm.Forms.Areas.Search.Instance;
            a.MdiParent = this;
            a.AutoSize = true;
            a.WindowState = FormWindowState.Maximized;
            a.Show();
        }
    }
}
